#ifndef TICKET_H
#define TICKET_H

#include <pthread.h>

#define MAXTHREADS 128

#define L1_CACHELINE_SIZE 128
#define L2_CACHELINE_SIZE 128

#define TICKET_TIME_UNIT 5

typedef struct
{
   int next_ticket;
   int now_serving;
} ticket_mutex_t;

int ticket_pause (int delay);
int ticket_mutex_init (ticket_mutex_t *mutex);
int ticket_mutex_lock (ticket_mutex_t *mutex); 
int ticket_mutex_unlock (ticket_mutex_t *mutex); 

#endif // !def TICKET_H
